/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file    can.h
  * @brief   This file contains all the function prototypes for
  *          the can.c file
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2025 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CAN_H__
#define __CAN_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

extern CAN_HandleTypeDef hcan1;

extern CAN_HandleTypeDef hcan2;

/* USER CODE BEGIN Private defines */

#define CAN1_M1 0
#define CAN1_M2 1
#define CAN1_M3 2

#define CAN1_MOTOR1_ID 0x205
#define CAN1_MOTOR2_ID 0x206
#define CAN1_MOTOR3_ID 0x203

void can_filter_init(void);



typedef struct
{
	float ecd_fdb;      
  float speed_rpm_fdb;
	int16_t current_fdb;	
	int8_t temperate_fdb;	
	int motor_num_of_turn;//转的圈数

	//实际给定的电流的返回值
	uint16_t current_set_fdb;
	//第一次角度返回值
	float angle_fdb_first;
	float ecd_fdb_first;
	
	//当前角度真实值
	float angle_fdb_now;		
	
	//霍尔开关值
	uint8_t hall_fdb;
	
}Motor_Feedback_t;

extern Motor_Feedback_t motor[3];




/* USER CODE END Private defines */

void MX_CAN1_Init(void);
void MX_CAN2_Init(void);

/* USER CODE BEGIN Prototypes */

/* USER CODE END Prototypes */

#ifdef __cplusplus
}
#endif

#endif /* __CAN_H__ */

